(function() {
	var _user_title_map = {
		"/user/main": "个人后台",
		"/user/order": "我的订单",
		"/user/info": {
			key: "id",
			value_map: {
				"*": "基本信息",
				"2": "密码管理",
				"3": "收货地址"
			}
		},
		"buff": {
			key: "type",
			value_map: {
				"*": "推荐返利",
				"2": "导购链接",
				"3": "分销管理"
			}
		},
		"/user/invite": "推荐注册",
		"/user/collection": {
			key: "type",
			value_map: {
				"*": "店铺收藏",
				"2": "商品收藏"
			}
		},
		"/user/comments": "评价管理"
	};
	App.set("$Event.user.main.user_login_out", function() {
		coAjax.get(appConfig.user.login_out_url, function() {
			App.set("loginer", null);
			Path.jump("/main.html");
			alert("warn", "您已退出登陆！！！");
		});
	});
	App.set("$Event.user.main.jumpToLogin", function() {
		myConfirm("您还未登陆，请先登陆", function() {
			Path.jump("/sign_in.html");
		});
	});
	App.set("$Event.user.main.show_location_store_share", function() {
		App.model.toggle("$Cache.user.main.show_location_store_share");
	});
	Path.on("/user/:user_page?", function(_current_location) {
		var title_info = _user_title_map[Path._current_page];
		if (typeof title_info === "string") {
			App.set("Path.document_title", title_info);
		} else if (typeof title_info === "object") {
			var _val = Path.getQuery(title_info.key);
			App.set("Path.document_title", (title_info.value_map[_val] || title_info.value_map["*"]));
		}
		console.log("USER Document title:", App.get("Path.document_title"));
	});
}());